#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void print_usage();

int main(int argc, const char *argv[])
{
	char *command;
	int size;
	if (argc != 3) {
		print_usage();
	}
	command = (char *)malloc(1024); /* 1K input buffer */
	sprintf(command, "gvim scp://root@%s//mnt/kiss/usercode/%s", argv[1], argv[2]);
	//I should reallocate memory after formatting the string.
	size = strlen(command) + 1;
	if(!realloc(command, size))
	{
		printf("unable to reallocate memory\n");
		return(0);
	}
	system(command);
	return(0);
}

void print_usage()
{
	printf("usage: ./gvimscp 'ip' 'filename'\n");
}